var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var BundleConfig = require("AA_BundleConfig");
var EventManager = require("AA_EventManager");
var LogManager = require("AA_LogManager");
var ResKeeper = require("AA_ResKeeper");
var UIManager = require("AA_UIManager");
var CommonUtils = require("AA_CommonUtils");
var EvenType = require("AA_EvenType");
var PlayerDataManager = require("AA_PlayerDataManager");
var UIConfig_Home = require("AA_UIConfig_Home");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_UIHomeAddCoin = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.icontag = null;
    t.count = null;
    t.addtype = 1;
    t.clickthen = 0;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype.onEnable = function () {
    EventManager.EventMgr.addEventListener(EvenType.EVENT_TYPE.Home_Add_Gold, this.onAddGold, this);
    EventManager.EventMgr.addEventListener(EvenType.EVENT_TYPE.Hall_ResetRich, this.updateUi, this);
    this.updateUi();
  };
  _creator.prototype.updateUi = function () {
    if (this.count) {
      switch (this.addtype) {
        case 1:
          this.count.string = PlayerDataManager.PlayerDataMgr.globalData.power + "/" + PlayerDataManager.PlayerDataMgr.globalData.maxPower;
          break;
        case 2:
          this.count.string = "" + PlayerDataManager.PlayerDataMgr.globalData.gold;
          break;
        case 3:
          this.count.string = "" + PlayerDataManager.PlayerDataMgr.globalData.diamond;
      }
    }
  };
  _creator.prototype.onAddGold = function (e, t) {
    if (this.addtype == e) {
      switch (e) {
        case 1:
          CommonUtils.default.showCoin(this.icontag.convertToWorldSpaceAR(cc.v2(0, 0)), null, t, "power");
          break;
        case 2:
          CommonUtils.default.showCoin(this.icontag.convertToWorldSpaceAR(cc.v2(0, 0)), null, t, "jinbi");
          break;
        case 3:
          CommonUtils.default.showCoin(this.icontag.convertToWorldSpaceAR(cc.v2(0, 0)), null, t, "zuanshi");
      }
    }
  };
  _creator.prototype.onDisable = function () {
    EventManager.EventMgr.rmEventListener(EvenType.EVENT_TYPE.Home_Add_Gold, this.onAddGold, this);
    EventManager.EventMgr.rmEventListener(EvenType.EVENT_TYPE.Hall_ResetRich, this.updateUi, this);
  };
  _creator.prototype.showDeBug = function () {
    if (PlayerDataManager.PlayerDataMgr.WHITE_NAME_NO_VIDEO) {
      this.clickthen += 1;
      LogManager.LogMgr.info("点击次数", this.clickthen);
      this.clickthen > 5 && UIManager.default.open(BundleConfig.BundleNames.Home, UIConfig_Home.UIView_Home.UI_DeBug);
      this.unschedule(this.resetClickThen);
      this.scheduleOnce(this.resetClickThen, .4);
    }
  };
  _creator.prototype.resetClickThen = function () {
    this.clickthen = 0;
  };
  __decorate([_property(cc.Node)], _creator.prototype, "icontag", undefined);
  __decorate([_property(cc.Label)], _creator.prototype, "count", undefined);
  __decorate([_property()], _creator.prototype, "addtype", undefined);
  return __decorate([_ccclass], _creator);
}(ResKeeper.default);
exports.default = _def_UIHomeAddCoin;